#!/bin/sh
FTP_IP=192.168.148.121
FTP_USER=dell
FTP_PASS=123
FTP_backup=/oraclebackup
BK_DR=/backup/oracledata/tsbak
DB_DR=/backup/oracledata/ts
DAYS=7
LINUX_USER=root
date=` date +%Y%m%d `
tar zcvf $BK_DR/TianShan$date.tar.gz $DB_DR
chown -R $LINUX_USER:$LINUX_USER $BK_DR
find $BK_DR -name "TianShan*" -type f -mtime +$DAYS -exec rm {} \;
deldate=` date -d -7day +%Y%m%d `
ftp -i  -v -n $FTP_IP << END
user $FTP_USER $FTP_PASS
binary
cd $FTP_backup
lcd $BK_DR
mput TianShan$date.tar.gz
mdelete TianShan$deldate.tar.gz
bye
END
